//search组件的小仓库
import { reqGetSearchInfo } from "@/api";
const state = {
    SearchInfo: {},
};
const actions = {
    async reqGetSearchInfo({ commit }, params = {}) {//默认参数
        let result = await reqGetSearchInfo(params);//至少传递一个空对象
        if (result.code == 200) {//请求成功
            commit('reqGetSearchInfo', result.data);
            console.log("搜索页信息获取成功")
        }
    }
};
const mutations = {
    reqGetSearchInfo(state,data) {
        state.SearchInfo = data;
        console.log(data)
    }
};
//计算属性主要是为了简化访问
const getters = {
    goodsList(state) {
        return state.SearchInfo.goodsList||[];//可能后期会有问题，SwarchInfo为{}
    },
    trademarkList(state) {
        return state.SearchInfo.trademarkList||[];//管我屁事
    },
    attrsList(state) {
        return state.SearchInfo.attrsList||[];
    }
};
export default {
    state,
    actions,
    mutations,
    getters
}